<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" href="/mdui/css/mdui.min.css">
    <script defer src="/mdui/js/mdui.min.js"></script>
    <script src="/js/axios.min.js"></script>
    <script src="/js/qs.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/vue.js"></script>
</head>
<body class="mdui-theme-primary-indigo mdui-theme-accent-pink">


<div class="mdui-container-fluid" id="app">

    <h1 class="mdui-text-color-theme">添加会议室</h1>
    <!-- 固定标签 -->
    <div class="mdui-textfield">
        <i class="mdui-icon material-icons">account_circle</i>
        <label class="mdui-textfield-label">会议室名称</label>
        <input class=" mdui-textfield-input" type="text" v-model="room.roomName"/>
    </div>
    <!-- 固定标签 -->
    <div class="mdui-textfield">
        <i class="mdui-icon material-icons">account_circle</i>
        <label class="mdui-textfield-label">会议室描述</label>
        <textarea class="mdui-textfield-input" rows="4" placeholder="请输入内容" v-model="room.descr"></textarea>

    </div>


    <div style="text-align: center">
        <button @click="addroom" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-green-800">新增</button>
        <a href="list.html" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-green-800">返回</a>
    </div>

</div>

<script>
    new Vue({
        el: '#app',
        data: {
            room: {
                roomName: "",
                descr: ""
            }
        },
        methods: {
            addroom() {

                if (this.room.roomName == '' || this.room.descr == "") {
                    mdui.alert("请填写内容")
                    return
                }
                let _this = this
                axios.post("/meetingroom/add", this.room)
                    .then(function (res) {
                        if (res.data.success) {
                            mdui.alert("添加成功")
                            _this.room.roomName = ''
                            _this.room.descr = ''
                        }
                    })
            }

        },

    })

</script>


</body>
</html>